{extend name="public/layout"}

{block name="title"}图片查看{/block}


{block name="main"}
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 图片管理 <span class="c-gray en">&gt;</span> 图片展示 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="pd-20">
    <div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"><a href="javascript:;" onclick="del_picture()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a> </span> <span class="r">共有数据：<strong>{$count}</strong> 条</span> </div>
    <div class="portfolio-content">
        <ul class="cl portfolio-area">
            {foreach $list as $v}
            <li class="item" id="item_{$v.id}">
                <div class="portfoliobox">
                    <input class="checkbox" name="chkContentId" type="checkbox" value="{$v.id}">
                    <div class="picbox"><img src="{$v.path}-w150" layer-src="{$v.path}" alt="{$v.pname}"></div>
                    <div class="textbox">{$v.pname} </div>
                </div>
            </li>
            {/foreach}

        </ul>
        <div id="page" style="margin-top: 20px"></div>
    </div>
</div>
{/block}

{block name="css"}
{/block}

{block name="js"}
{load href="__ADMIN__/lib/laypage/1.2/laypage.js"/}
<script type="text/javascript">
layer.config({
  extend: 'extend/layer.ext.js'
});
$(function(){
    laypage({
        cont: $('#page'), //容器。值支持id名、原生dom对象，jquery对象,
        pages: {$max_page}, //总页数
        skip: true, //是否开启跳页
        groups: 3, //连续显示分页数
        curr: function(){ //通过url获取当前页，也可以同上（pages）方式获取
            var page = location.search.match(/page=(\d+)/);
            return page ? page[1] : 1;
        }(),
        jump: function(obj, first){ //触发分页后的回调
            if(!first){ //点击跳页触发函数自身，并传递当前页：obj.curr
                location.href = '{$url}page='+obj.curr;
            }
        }
    });

    $(".item").hover(function(){
        $(this).attr('class','item hover');
    },function(){
        $(this).attr('class','item');
    })
});

$(window).load(function() {
    layer.photos({
         photos: '.picbox'
    });
});

function del_picture(){
    layer.confirm('是否确定删除选中图片？',{icon:0},function(index){
        layer.close(index);
        $('input[name="chkContentId"]:checked').each(function() {
            var did = $(this).val();
            $.post('{:U("picture/delPicture")}',{pid:did},function($data){
                if($data.status == 'n'){
                    layer.msg($data.info,{icon:2,time:1000});
                    return false;
                }else{
                    $("#item_"+did).remove();
                }
            },'json')
        });
    });
}
</script>
{/block}
